package com.ynny.service;

import com.ynny.bean.User;
import com.ynny.dao.UserManage;
import jdk.internal.icu.impl.NormalizerImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;

@Component("userManage")
public class UserManageImpl implements UserManage {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public boolean login(User user) {
        String sql = "select * from user where number = ? and password = ? and identity = ?";
        Object[] obj = new Object[]{user.getNumber(), user.getPassword(), user.getIdentity()


        };


        RowMapper<User> rowMapper = null;

        new BeanPropertyRowMapper<User>(User.class);
        jdbcTemplate.query(sql, rowMapper, obj);

        NormalizerImpl.ReorderingBuffer user_db = null;
        if (!user_db.isEmpty()){
            return true;
        }
        return false;
    }

    @Override
    public void quint(){
        System.out.println("退出登录");
    }
}
